package com.primaryAlgorithm;

/**
 * Description:
 * Copyright:   Copyright (c)2019
 * Company:     zefu
 *
 * @author: 张李鑫
 * @version: 1.0
 * Create at:   2021-09-27 15:24:27
 * <p>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2021-09-27     张李鑫                     1.0         1.0 Version
 */
public class PlusOne {

    public static int[] plusOne(int[] digits) {
        int length = digits.length;
        while (length > 0) {
            if (digits[length - 1] + 1 != 10) {
                digits[length - 1]++;
                return digits;
            }
            digits[length - 1] = 0;
            length--;
        }
        int[] arr = new int[digits.length + 1];
        arr[0] = 1;
        return arr;
    }


    public static void main(String[] args) {
        int[] arr = {9};
        int[] ints = plusOne(arr);
        System.out.println(123);
    }
}
